#ifndef SOLUTION_H_
#define SOLUTION_H_
#define NULL 0
class Solution 
{
public:
    char *strStr(char *str, char *sub) 
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		if(!str || !sub)
			return NULL;

		int subLen = 0;
		char* csub = sub;
		while(*csub++) subLen++;

		int strLen = 0;
		char* cstr = str;
		while(*cstr++) strLen++;

		if(strLen < subLen)
			return NULL;

		for(int i=0;i<(strLen-subLen+1);i++)
		{
			csub = sub;
			cstr = str+i;
			while((*csub==*cstr) && *csub)
			{
				csub++;
				cstr++;
			}
			if(!(*csub))
			{
				return str+i;
			}
		}

		return NULL;
    }
};
#endif